<template>
	<view class="content">
		<!-- <button class="openLogin" data-eventsync="true" @click="getDouyinLogin" >
			<text>{{loginFlag==true?'去领券':'抖音登录领券'}}</text>
		</button>
		<button class="openLogin" style="top: 250px;" v-show="loginFlag==true" @click="quitLogin">重新登录</button> -->
<!-- 		<text class="h2">piece动画APP使用简介</text>
		<text>{{`1、打开皮皮推文APP，点击首页推文动画创作按钮，设置好画面风格等基础设置后点击下一步，进行文本粘贴
				2、文本确认后进入编辑页面，编辑页面支持编辑文案，固定人物和背景，敏感词检测操作，点击立即生成后回到首页显示任务进度
				3、在首页显示任务生成进度，生成完成后可点击领取，支持导出视频或者进入高级编辑器
				4、在高级编辑器页面支持重新生成图片和调整文本字幕`}}</text>
		<text class="h2">领券及会员介绍</text> -->
		<view class="logoImg">
			<image class="logo" src="/static/index.jpg" mode="widthFix"></image>
		</view>
		<!-- <video  id="myVideo" src="https://imgs.pencil-stub.com/data/cms/2024-03-26/76172875dff84d29be5502538e7a16bc.mp4"  controls></video> -->
		
		
		<Menu style="width: 100%;"></Menu>
<!-- 		<view class="kefuBox" >
			<button open-type="privateMessage" data-aweme-id="54569746471" >
			  私信咨询
			</button>
		</view> -->
		
		<view class="kefuBox" @click="callKefu">
			<image class="kefu" src="../../static/客服.png" mode="widthFix"></image>
			<button open-type="privateMessage" data-aweme-id="54569746471" >
			  私信咨询
			</button>
		</view>
	</view>
</template>

<script>
	import api from '../../api/api'
	import {
		parseUserData,
		setInfo,
		quit,
	} from '../../hook/auth.js'
	import Menu from "../components/menu.vue"
	export default {
		components:{Menu},
		data() {
			return {
				title: '首页',
				loginFlag :false,
			}
		},
		onLoad() {
			this.getLocalLoginInfo()
		},
		methods: {
			//获取本地登录信息
			getLocalLoginInfo() {
				const userData = parseUserData()
				this.loginFlag = !!userData.id
				console.log("获取本地登录信息",this.loginFlag)
			},
			
			//退出登录
			quitLogin() {
				console.log('退出登录')
				quit()
				//获取本地信息，刷新显示
				this.getLocalLoginInfo()
				uni.reLaunch({
					url: '/pages/index/index'
				});

			},

			goto(url){
				uni.navigateTo({
					url: url
				})
			},
			//抖音授权登录
			 getDouyinLogin(){
				const self = this
				//有登录信息，不需要再登
				if(self.loginFlag){
					this.goto("/pages/index/coupon")
				}else{
					//没有登录信息，调用抖音登录
					 tt.getUserProfile({
					  success(res) {
						  //跳转绑定
					    console.log("getUserProfile 调用成功：", res.userInfo);
						self.goto("/pages/index/login")
					  },
					  fail(res) {
					    console.log("getUserProfile 调用失败", res);
					  },
					});
				}
			}

		}
	}
</script>

<style scoped>
	.kefuBox button{
		width: 100px;
		height: 28px;
		opacity: 1;
		border-radius: 15.14px;
		background: rgba(18, 205, 217, 1);
		border: 0.68px solid rgba(0, 186, 173, 1);
		box-shadow: 0px 0.68px 1.36px  rgba(67, 207, 124, 0.25);
		/** 文本1 */
		font-size: 12px;
		font-weight: 500;
		letter-spacing: 0.68px;
		line-height: 28px;
		color: rgba(255, 255, 255, 1);
	}
	.kefu{
		width: 50px;
	}
	.kefuBox{
		text-align: center;
		position: fixed;
		left: 20px;
		bottom: 100px;
		/* width: 50px; */
	}
	
	#myVideo{
		margin: 0 auto;
		height: calc(100vh - 400px) ;
		min-height: 300px;
	}
	.content .h2{
		font-size: 16px;
		font-weight: 500;
		line-height: 40px;
		color: rgba(255, 255, 255, 1);
		text-align: left;
	}
	text{
		font-size: 10px;
		font-weight: 400; 
		line-height: 20px;
		color: rgba(255, 255, 255, 1);
		text-align: left;
	}
	

		

	.openLogin{
		position: fixed;
		right: 10%;
		top: 200px;
		width: 160px;
		height: 37.5px;
		opacity: 1;
		border-radius: 36.5px;
		background: rgba(18, 205, 217, 1);
		
		font-size: 15px;
		font-weight: 400;
		letter-spacing: 1px;
		color: rgba(255, 255, 255, 1);
		text-align: center;
		vertical-align: top;


	}
	.content {
		display: flex;
		flex-direction: column;
		/* align-items: center; */
		/* justify-content: center; */
		height: 100vh;
		background-color: rgba(34, 34, 34, 1);
	}
	.logoImg{
		width: 100%;
		overflow-y: auto;
		padding-bottom: 80px;
	}
	.logo {
		width: 100%;
		overflow-y: auto;
	}

	.text-area {
		display: flex;
		justify-content: center;
	}

	.title {
		font-size: 36rpx;
		color: #8f8f94;
	}
</style>
